package cn.iocoder.aics.module.member.dal.mysql.chatcontext;

import java.util.*;

import cn.iocoder.aics.framework.common.pojo.PageResult;
import cn.iocoder.aics.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.aics.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.aics.module.member.dal.dataobject.chatcontext.ChatContextDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.aics.module.member.controller.admin.chatcontext.vo.*;

/**
 * 聊天上下文 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ChatContextMapper extends BaseMapperX<ChatContextDO> {

    default PageResult<ChatContextDO> selectPage(ChatContextPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ChatContextDO>()
                .eqIfPresent(ChatContextDO::getType, reqVO.getType())
                .eqIfPresent(ChatContextDO::getUserId, reqVO.getUserId())
                .likeIfPresent(ChatContextDO::getName, reqVO.getName())
                .betweenIfPresent(ChatContextDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ChatContextDO::getId));
    }

}